<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%  
String path = request.getContextPath();  
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>挪车位</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=yes" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/parking.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
    <script type="text/javascript" src="<%=basepath%>js/ajax-pushlet-client.js"></script>
</head>
<body>
<div class="viewport">
    <div class="header">
       <div class="header-1">
           <a href="javascrpt:void(0)" id="join" class="header-2">
              <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
           </a>
           <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=yuexi&prefix=3g_mmzs&entrance=yes" class="back" id="back">返回</a>
           <span class="span-num">WWP21400</span>
       </div>
    </div>
    <div class="content m-top">
        <div class="hr-1">请选择要更换的车位</div>
        <div class="fix">
            <div class="fix-1">
            <c:forEach var="item" items="${parkAreaList}">
                <c:if test="${item.departmentId == parkArea }">
                    <a href="/wape-web/api/core/centerService?serviceCode=MMZS202&t_p=${item.departmentId }&sonStoreId=${sonStoreId}" class="fix-1-1 li-active">${item.sonDepart }</a>
                </c:if>
                <c:if test="${item.departmentId != parkArea }">
                    <a href="/wape-web/api/core/centerService?serviceCode=MMZS202&t_p=${item.departmentId }&sonStoreId=${sonStoreId}" class="fix-1-1">${item.sonDepart }</a>
                </c:if>
            </c:forEach>
            </div> 
        </div>
        <div class="blank-m"></div>
        <div class="content-1">
            <c:forEach var="item" items="${parkPosList}">
                <div class="content-1-1"><span>${item.sonDepart}</span></div>
	            <div class="content-1-2">
	                <ul>
	                   <c:forEach var="go" items="${parkList.get(item.departmentId)}">
	                       <c:if test="${go.carParkState == null or go.carParkState == '0'}">
	                           <li class="${go.departmentId}"><a href="/wape-web/api/core/centerService?serviceCode=MMZS203&oldSonStoreId=${sonStoreId}&sonStoreId=${go.departmentId}">${go.sonDepart}</a></li>
	                       </c:if>
	                       <c:if test="${go.carParkState == '1'}">
	                           <li class="${go.departmentId} li-active"><a href="javascript:;" style="cursor:default;">${go.sonDepart}</a></li>
	                       </c:if>
	                       <c:if test="${go.carParkState == '2'}">
	                           <li class="${go.departmentId} li-active-2"><a href="javascript:;" style="cursor:default;">${go.sonDepart}</a></li>
	                       </c:if>
	                   </c:forEach>
	                </ul>
	            </div>
	            <div class="blank"></div>
            </c:forEach>
        </div>
    </div>
    <div class="blank-b"></div>
</div>
</body>
<script type="text/javascript">
   /*错误提示*/
   $(function(){
       var error = "${requestScope.returnMsg}";
       if(error != "" && error != "成功!"){
           layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
       }
   });
   /*Tab*/
   $(function(){
       var error = "${requestScope.remsg}";
       if(error != ""){
         layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
       } 
       
	   $(".fix-1").animate({scrollLeft:$(".li-active").offset().left-81+"px"}, 0);
   });
</script>
<script type="text/javascript">
    //实时更新车辆的状态
    //初始化pushlet客户端
    PL._init();
    //设定运行时显示调试信息，不需要时，直接删掉即可
    PL.setDebug(false);
    //设定监听主题：/wape/carStatus, 与服务器端的主题完全一致
    PL.joinListen('/wape/carStatus');
    //接收到事件后，显示服务器信息
    function onData(event) {
        var _currSonStoreId = event.get("currSonStoreId");
        var _status = event.get("status");
        if(_status == '0') {
            $('li.' + _currSonStoreId).removeClass('li-active').removeClass('li-active-2');
            $('li.' + _currSonStoreId).find("a")
            .attr('href', '/wape-web/api/core/centerService?serviceCode=MMZS202&oldSonStoreId=${sonStoreId}&sonStoreId=${go.departmentId}')
            .attr('style', 'cursor:pointer;');
        } else if(_status == '1') {
            $('li.' + _currSonStoreId).removeClass('li-active').removeClass('li-active-2').addClass('li-active');
            $('li.' + _currSonStoreId).find("a").attr('href', 'javascript:;').attr('style', 'cursor:default;');
        } else if(_status == '2') {
            $('li.' + _currSonStoreId).removeClass('li-active').removeClass('li-active-2').addClass('li-active-2');
            $('li.' + _currSonStoreId).find("a").attr('href', 'javascript:;').attr('style', 'cursor:default;');;
        }
    }
</script>
</html>


